#include <iostream>
#include <map>
#include <boost/lexical_cast.hpp>

using std::cout;
using std::endl;
using std::map;
using std::string;

string
dec_to_any(string in, map<int, string> conversion)
{
    int x = boost::lexical_cast<int>(in);
    int target_base = conversion.size();

    if (x == 0)
    {
        return "0";
    }

    string out = "";

    while (x > 0)
    {
        string prepend = conversion[x % target_base];

        out = prepend + out;

        x /= target_base;
    }

    return out;
}

int
main(int argc, char **argv)
{
    map<int, string> cvt;

    cvt[0] = "0";
    cvt[1] = "1";
    cvt[2] = "2";
    cvt[3] = "3";

    cout << dec_to_any("0", cvt) << endl;
    cout << dec_to_any("1", cvt) << endl;
    cout << dec_to_any("2", cvt) << endl;
    cout << dec_to_any("3", cvt) << endl;
    cout << dec_to_any("4", cvt) << endl;
    cout << dec_to_any("5", cvt) << endl;
    cout << dec_to_any("6", cvt) << endl;
}
